package com.hdy.demo.aop.action;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.hdy.demo.aop.dto.CupDto;
import com.hdy.demo.aop.service.MyAopService;
import com.hdy.framework.struts2.action.BaseAction;

/*
	by 何栋宇
	2013-1-30
	http://127.0.0.1/ssh/aop/in.action
 */
//
@Scope("prototype")
@Component("myAopAction")
public class MyAopAction extends BaseAction implements InitializingBean{
	@Resource(name="myAopService")//放在属性可以省略get set方法 也可以放在set方法前面
	private MyAopService myAopService;
	private List<CupDto> ls ;
	@Override
	public String execute() {
		ls = this.myAopService.getCacheList(110);
		log.error("测试log4j");
		getLog(MyAopAction.class).error("下面的不被aop");
		getLog(MyAopAction.class).info("下面的不被aop");
		getLog(MyAopAction.class).debug("下面的不被aop");
		this.myAopService.getNoCacheList(911);
		return SUCCESS;
	}
	@Override
	public void afterPropertiesSet() throws Exception {
		System.out.println("初始化MyAopAction成功");
	}
	public List<CupDto> getLs() {
		return ls;
	}
	public void setLs(List<CupDto> ls) {
		this.ls = ls;
	}
	
}
